Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: no error for inline array schema when items field is a ref #257

Merged
merged 1 commit into from
Mar 8, 2021

Conversation

barrett-schonefeld
Copy link
Contributor

@barrett-schonefeld barrett-schonefeld commented Mar 3, 2021

Purpose:

  • generator flattens reference to an array schema back into an inline schema

Changes:

  • Add a check to see if the schema is an array with an items field that uses a ref or a primitive type (boolean, integer, number, string)
    • Note: this update is only for response schemas. I looked through the different semantic validators and only found the inline_response_schema check. I did not find an equivalent check for inline request bodies.

Tests:

  • Add tests to ensure the validator does not flag different variations of this array schema
  • Update expected warnings in tests that use specs with this array schema

Copy link
Contributor

@mkistler mkistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good but I think there is a twist that we need to consider.

Copy link
Contributor

@mkistler mkistler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

Purpose:
- generator flattens reference to an array schema back into an inline schema

Changes:
- Add a check to see if the schema is an array with an items field that uses a ref
- Add a check to see if the array schema has primitive type items
- Add reusable isPrimitiveType function

Tests:
- Add tests to ensure the validator does not flag different variations of this array schema
- Update expected warnings in tests that use specs with this array schema
- Add test to ensure arrays with primitive-type items are not flagged
- Add tests for isPrimitiveType function
Copy link
Member

@dpopp07 dpopp07 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! 👍

@barrett-schonefeld barrett-schonefeld merged commit 4dd3708 into main Mar 8, 2021
@barrett-schonefeld barrett-schonefeld deleted the array-schema-reference branch March 8, 2021 19:05
dpopp07 pushed a commit that referenced this pull request Mar 8, 2021
## [0.35.1](v0.35.0...v0.35.1) (2021-03-08)

### Bug Fixes

* no error for inline array schema when items field is a ref ([#257](#257)) ([4dd3708](4dd3708))
@dpopp07
Copy link
Member

dpopp07 commented Mar 8, 2021

🎉 This PR is included in version 0.35.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants